const mongoose = require('mongoose')

const houseTypeRecord = new mongoose.Schema(
    {
        houseType: { // 操作记录对应的房型
            type: mongoose.SchemaTypes.ObjectId,
            ref: 'houseType'
        },
        title: String,
        author: {
            type: mongoose.SchemaTypes.ObjectId,
            ref: 'user',
            required: true
        },
        houseNum: {
            type: Number,
            required: true
        },
        area: {
            type: String,
            required: true
        },
        swiper: [
            {
                type: String
            }
        ],
        baseInstallation: [ // 基础设施
            {
                type: mongoose.SchemaTypes.ObjectId,
                ref: 'baseInstallation'
            }
        ],
        breakfirst: { // 早餐
            type: String,
            default: ''
        },
        bed: { // 床型信息
            type: String,
        },
        type: { // 房型类型 0 钟点房 1 普通订房
            type: Number,
            default: 1,
            required: true
        },
        price: { // 价格
            type: Number,
            required: true
        },
        cashPledge: { // 押金
            type: Number,
            required: true
        },
        smokeLess: { // 是否无烟房
            type: String,
            default: ''
        },
        maxPerson: { // 最大入住人数
            type: String,
            default: '1人'
        },
        attention: { // 注意事项
            type: String,
            default: ''
        },
        isDeleted: {
            type: Number,
            default: 0 // 0 没有删除， 1 删除了
        },
        base: [
            {
                type: String
            }
        ]
    },
    {
        versionKey: false,
        timestamps: {createdAt: 'create_time', updatedAt: 'update_time'},
    }
)

module.exports = mongoose.model('houseTypeRecord', houseTypeRecord)
